@extends('admin.layout')
@section('title','专家管理页')
@section('content')

    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" >
        <div class="col-md-12" id="content" >
            <div class="app_content_div" id="app_content_div_301Index">
                <h3>直播录播管理</h3>
            </div>
            <div style="float:right;"><button type="button" class="btn btn-primary" onclick="window.location.href='/adm/video/add'">新增视频</button></div>
            <br><br><br>
            <table class="table table-striped">
                <thead>
                <tr>
                    <th>id</th>
                    <th>标题</th>
                    <th>科室</th>
                    <th>专家</th>
                    <th>类型</th>
                    <th>直播开始时间</th>
                    <th>直播结束时间</th>
                    <!--           <th>更新签到积分</th>-->
                    <!--           <th>试题列表</th>-->
                    <!--           <th>积分导出</th> -->
                    <!--          <th>周报导出</th>  -->
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($oVideo as $value)
                    @foreach($value->expert as $v)
                    <tr>
                        <th>{{$value->id}}</th>
                        <td>{{$value->name}}</td>
                        <td>{{$v->keshi}}</td>
                        <td>{{$v->name}}</td>
                        @if($value->leixing==1)
                            <td>直播</td>
                        @elseif($value->leixing==0)
                            <td>录播</td>
                        @endif                  {{--这里我也不知道 再改--}}
                        <td>{{$value->kaishishijian}}</td>
                        <td>{{$value->jieshushijian}}</td>
                        <td>
                            <a href="/adm/video/edit/{{$value->id}}"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a>
                            &nbsp;&nbsp;&nbsp;
                            <a onclick="del({{$value->id}});"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
                        </td>
                    </tr>
                    @endforeach
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
    <script>
        function del(id){
            $.ajax({
                url:'/video/'+id,
                type:'DELETE',
                dataType:'json',
                data:{'_token':'{{csrf_token()}}'},
                success:function (data){
                    alert('删除成功');
                    location.href='/video';
                },
                error:function (data){}
            });
        }
    </script>


@endsection
